<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景颜色半透明</title>
    <style>
        div {
            width: 500px;
            height: 500px;
            /* background-color:  black; */
            background: rgba(0, 0, 0, .3);
        }
    </style>
</head>
<body>
    <div><img src="img/背景颜色半透明实现方法.png" alt=""></div>
</body>
</html>